package com.woohua.thread.demo;

/***
 * @title Count
 * @description：原子性例子：原子操作，线程安全
 * @author woo hua
 * @version 1.0.0
 * @create 2023/3/9 11:12
 **/
public class Count {
    private int count;

    public synchronized void increase() {
        count = count + 1;
    }

    /**
     * 原子操作可不加同步关键字
     * @return
     */
    public int getCount() {
        return count;
    }
}
